using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace HRM.Models.Mapping
{
    public class dk_CTGiangDayMap : EntityTypeConfiguration<dk_CTGiangDay>
    {
        public dk_CTGiangDayMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.MonHoc)
                .HasMaxLength(50);

            this.Property(t => t.KhoiLop)
                .HasMaxLength(10);

            this.Property(t => t.HocKi)
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.GhiChu)
                .HasMaxLength(200);

            this.Property(t => t.TenNV)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.MaDDKy)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("dk_CTGiangDay");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.MonHoc).HasColumnName("MonHoc");
            this.Property(t => t.KhoiLop).HasColumnName("KhoiLop");
            this.Property(t => t.SoTiet).HasColumnName("SoTiet");
            this.Property(t => t.HocKi).HasColumnName("HocKi");
            this.Property(t => t.GhiChu).HasColumnName("GhiChu");
            this.Property(t => t.TenNV).HasColumnName("TenNV");
            this.Property(t => t.MaDDKy).HasColumnName("MaDDKy");

            // Relationships
            this.HasOptional(t => t.DotDK_TK)
                .WithMany(t => t.dk_CTGiangDay)
                .HasForeignKey(d => d.MaDDKy);

        }
    }
}
